package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppCommentReplyDao;
import com.vf.admin.client.service.AppCommentReplyService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppCommentReply;
import com.vf.admin.miaodong.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class AppCommentReplyServiceImpl implements AppCommentReplyService {

    @Autowired
    AppCommentReplyDao appCommentReplyDao;

    @Override
    public void saveOrUpdate(AppCommentReply appCommentReply) {
        appCommentReplyDao.save(appCommentReply);
    }
    @Override
    public void plHuifuSave(Integer commentid,AppUser user,AppUser reply,String neirong) {
        AppCommentReply commentReply = new AppCommentReply();
        commentReply.setCommentid(commentid);
        commentReply.setUserid(user.getId());
        commentReply.setNick(user.getNick());
        commentReply.setPic(user.getPic());
        commentReply.setPhone(user.getLoginname());
        commentReply.setSex(user.getSex());
        commentReply.setReplyid(reply.getId());
        commentReply.setReplynick(reply.getNick());
        commentReply.setReplypic(reply.getPic());
        commentReply.setReplyphone(reply.getLoginname());
        commentReply.setReplysex(reply.getSex());
        commentReply.setNeirong(neirong);
        commentReply.setStatus(1);
        commentReply.setCreatetime(new Date());
        appCommentReplyDao.save(commentReply);
    }

    @Override
    public AppCommentReply getById(Integer id) {
        return appCommentReplyDao.get(id);
    }

    @Override
    public List<AppCommentReply> appFindList(Map<String, Object> paramap, SplitPageBean splitPageBean) {
        return appCommentReplyDao.list(paramap, splitPageBean);
    }

    @Override
    public List<AppCommentReply> specificUserList(Integer commentid, SplitPageBean splitPageBean) {
        return appCommentReplyDao.specificUserList(commentid, splitPageBean);
    }

    @Override
    public List<AppCommentReply> hfcount(Integer commentid) {
        return appCommentReplyDao.hfcount(commentid);
    }

    @Override
    public void updateStatus(Integer id,Integer status) {
        appCommentReplyDao.updateStatus(id,status);
    }
}
